package com.yaoxuguang.concurrence.singletonAndThread.lazy_beggar_model;

/**
 * @author yaoxuguang
 * @Title: yao-interview
 * @Package com.yaoxuguang.concurrence.singletonAndThread.lazy_beggar_model
 * @Description: 懒汉单例模式
 * @date 2018年12月25日11:35
 */
public class MyObject {
    private static MyObject object;
    private MyObject() {
    }
  /*  public static MyObject getInstance(){
        if(object == null){
            object = new MyObject();
        }
        return object;
    }*/
  public static MyObject getInstance(){
      if(object != null){

      }else{
          synchronized (MyObject.class){
              if (object != null){

              }else{
                  object = new MyObject();
              }
          }
      }
      return object;
  }
}
